
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Android UI美化之 shape的使用及其属性总结 · 《前端学习笔记》</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="XiaoChen">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-ancre-navigation/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../ReactNative/CodePush 热更新配置及使用.html" />
    
    
    <link rel="prev" href="Android 多包名打包应用.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        <li class="header">前言</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Android</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="Android 多包名打包应用.html">
            
                <a href="Android 多包名打包应用.html">
            
                    
                    Android 多包名打包应用
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.2" data-path="Android UI美化之 shape的使用及其属性总结.html">
            
                <a href="Android UI美化之 shape的使用及其属性总结.html">
            
                    
                    Android UI美化之 shape的使用及其属性总结
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">ReactNative</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../ReactNative/CodePush 热更新配置及使用.html">
            
                <a href="../ReactNative/CodePush 热更新配置及使用.html">
            
                    
                    CodePush 热更新配置及使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../ReactNative/已有Android工程 集成React Native.html">
            
                <a href="../ReactNative/已有Android工程 集成React Native.html">
            
                    
                    已有Android工程 集成React Native
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Egret</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../Egret/Egret 白鹭引擎参考资料.html">
            
                <a href="../Egret/Egret 白鹭引擎参考资料.html">
            
                    
                    Egret 白鹭引擎参考资料
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="../Egret/EGER PRO.html">
            
                <a href="../Egret/EGER PRO.html">
            
                    
                    EGER PRO
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="../Egret/Egret 寻路.html">
            
                <a href="../Egret/Egret 寻路.html">
            
                    
                    Egret 寻路
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">工具</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../Tools/homebrew 使用.html">
            
                <a href="../Tools/homebrew 使用.html">
            
                    
                    homebrew 使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../Tools/git 使用.html">
            
                <a href="../Tools/git 使用.html">
            
                    
                    git 使用
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">小程序</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../MiniApp/Atom 完美支持 WePY 小程序开发.html">
            
                <a href="../MiniApp/Atom 完美支持 WePY 小程序开发.html">
            
                    
                    Atom 完美支持 WePY 小程序开发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="../MiniApp/Atom 插件安装慢解决方案.html">
            
                <a href="../MiniApp/Atom 插件安装慢解决方案.html">
            
                    
                    Atom 插件安装慢解决方案
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Vue</li>
        
        
    
        <li class="chapter " data-level="7.1" data-path="../Vue2/Web 前端环境搭建.html">
            
                <a href="../Vue2/Web 前端环境搭建.html">
            
                    
                    Web 前端环境搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="../Vue2/Vue 项目搭建.html">
            
                <a href="../Vue2/Vue 项目搭建.html">
            
                    
                    Vue 项目搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="../Vue2/初识 VueCli 3.html">
            
                <a href="../Vue2/初识 VueCli 3.html">
            
                    
                    初识 VueCli 3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.4" data-path="../Vue2/使用 VueCli 3.html">
            
                <a href="../Vue2/使用 VueCli 3.html">
            
                    
                    使用 VueCli 3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.5" data-path="../Vue2/VueCli 3 项目配置.html">
            
                <a href="../Vue2/VueCli 3 项目配置.html">
            
                    
                    VueCli 3 项目配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.6" data-path="../Vue3/Vue3探索.html">
            
                <a href="../Vue3/Vue3探索.html">
            
                    
                    初识 Vue3
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">微前端</li>
        
        
    
        <li class="chapter " data-level="8.1" data-path="../MicroApp/qiankun/">
            
                <a href="../MicroApp/qiankun/">
            
                    
                    qiankun
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">团队成长</li>
        
        
    
        <li class="chapter " data-level="9.1" data-path="../Team/Web前端开发规范.html">
            
                <a href="../Team/Web前端开发规范.html">
            
                    
                    开发规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.2" data-path="../Team/Web团队建设--npm私库搭建.html">
            
                <a href="../Team/Web团队建设--npm私库搭建.html">
            
                    
                    私库搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.3" data-path="../Team/Web团队建设--自定义脚手架.html">
            
                <a href="../Team/Web团队建设--自定义脚手架.html">
            
                    
                    脚手架搭建
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >Android UI美化之 shape的使用及其属性总结</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-anchor"></i><ul><li><span class="title-icon "></span><a href="#android-ui&#x7F8E;&#x5316;&#x4E4B;-shape&#x7684;&#x4F7F;&#x7528;&#x53CA;&#x5176;&#x5C5E;&#x6027;&#x603B;&#x7ED3;"><b></b>Android UI&#x7F8E;&#x5316;&#x4E4B; shape&#x7684;&#x4F7F;&#x7528;&#x53CA;&#x5176;&#x5C5E;&#x6027;&#x603B;&#x7ED3;</a></li></ul></div><a href="#android-ui&#x7F8E;&#x5316;&#x4E4B;-shape&#x7684;&#x4F7F;&#x7528;&#x53CA;&#x5176;&#x5C5E;&#x6027;&#x603B;&#x7ED3;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="android-ui&#x7F8E;&#x5316;&#x4E4B;-shape&#x7684;&#x4F7F;&#x7528;&#x53CA;&#x5176;&#x5C5E;&#x6027;&#x603B;&#x7ED3;"><a name="android-ui&#x7F8E;&#x5316;&#x4E4B;-shape&#x7684;&#x4F7F;&#x7528;&#x53CA;&#x5176;&#x5C5E;&#x6027;&#x603B;&#x7ED3;" class="anchor-navigation-ex-anchor" href="#android-ui&#x7F8E;&#x5316;&#x4E4B;-shape&#x7684;&#x4F7F;&#x7528;&#x53CA;&#x5176;&#x5C5E;&#x6027;&#x603B;&#x7ED3;"><i class="fa fa-link" aria-hidden="true"></i></a>Android UI&#x7F8E;&#x5316;&#x4E4B; shape&#x7684;&#x4F7F;&#x7528;&#x53CA;&#x5176;&#x5C5E;&#x6027;&#x603B;&#x7ED3;</h1>
<p>&#x8FD1;&#x671F;&#x5728;&#x6574;&#x7406;&#x9879;&#x76EE;&#x7684;&#x8FC7;&#x7A0B;&#x4E2D;&#x7A81;&#x7136;&#x53D1;&#x73B0;&#x9879;&#x76EE;&#x4E2D;&#x6709;&#x597D;&#x591A;&#x672A;&#x66FE;&#x4F7F;&#x7528;&#x8FC7;&#x7684;&#x56FE;&#x7247;&#xFF0C;&#x7ECF;&#x8FC7;&#x5BF9;&#x6BD4;UI&#x8BBE;&#x8BA1;&#x56FE;&#x7247;&#x5E76;&#x68C0;&#x67E5;&#x4EE3;&#x7801;&#x540E;&#x53D1;&#x73B0;&#x5728;UI&#x4E0A;&#x7684;&#x8FD9;&#x4E9B;&#x5730;&#x65B9;&#x90FD;&#x662F;&#x901A;&#x8FC7;<code>drawable</code>
&#x4E0B;&#x9762;&#x7684;&#x8D44;&#x6E90;&#x6587;&#x4EF6;&#x8BBE;&#x7F6E;&#x7684;&#x80CC;&#x666F;&#xFF0C;&#x4E8E;&#x662F;&#x4FBF;&#x60F3;&#x8D77;&#x6765;&#x6574;&#x7406;&#x4E00;&#x4E0B;&#x5173;&#x4E8E;&#x6B64;&#x7C7B;UI&#x7F8E;&#x5316;&#x7684;&#x4E1C;&#x897F;&#xFF0C;&#x82E5;&#x5B58;&#x5728;&#x5199;&#x7684;&#x4E0D;&#x597D;&#x7684;&#x5730;&#x65B9;&#x8FD8;&#x5E0C;&#x671B;&#x5927;&#x5BB6;&#x591A;&#x591A;&#x6307;&#x5BFC;&#x3002;</p>
<p>&#x672C;&#x7CFB;&#x5217;&#x9884;&#x8BA1;&#x5171;3&#x90E8;&#x5206;&#xFF0C;&#x672C;&#x6587;&#x5177;&#x4F53;&#x5185;&#x5BB9;&#x4E3A; <code>shape</code> &#x7684;&#x4F7F;&#x7528;&#xFF0C;&#x7531;&#x4E8E;&#x53E6;&#x5916;&#x4E24;&#x7BC7;&#x6587;&#x7AE0;&#x6682;&#x65F6;&#x672A;&#x6574;&#x7406;&#xFF0C;&#x6B64;&#x5904;&#x4FBF;&#x5148;&#x5217;&#x51FA;&#x6587;&#x7AE0;&#x6807;&#x9898;&#xFF0C;&#x540E;&#x671F;&#x4F1A;&#x5BF9;&#x6B64;&#x6DFB;&#x52A0;&#x94FE;&#x63A5;&#xFF1A;</p>
<ul>
<li><strong>Android UI &#x7F8E;&#x5316;&#x4E4B; shape &#x7684;&#x4F7F;&#x7528;</strong></li>
<li><strong>Android UI &#x7F8E;&#x5316;&#x4E4B; selector &#x7684;&#x4F7F;&#x7528;</strong></li>
<li><strong>Android UI &#x7F8E;&#x5316;&#x4E4B; layer-list &#x7684;&#x4F7F;&#x7528;</strong></li>
</ul>
<hr>
<p>&#x8A00;&#x5F52;&#x6B63;&#x4F20;&#xFF0C;&#x76F8;&#x4FE1;&#x5927;&#x5BB6;&#x5728;&#x9879;&#x76EE;&#x4E2D;&#x90FD;&#x7528;&#x8FC7;&#x5F88;&#x591A;&#x7528; <code>shape</code>
&#x5B9A;&#x4E49;&#x7684;&#x6548;&#x679C;&#xFF0C;&#x5927;&#x591A;&#x662F;&#x4E00;&#x4E9B;&#x8F83;&#x4E3A;&#x89C4;&#x5219;&#x7684;&#x56FE;&#x5F62;&#xFF0C;&#x5982;&#x5706;&#x5F62;&#x3001;&#x77E9;&#x5F62;&#x3001;&#x5B9E;&#x7EBF;&#x865A;&#x7EBF;&#x4EE5;&#x53CA;&#x6E10;&#x53D8;&#x8272;&#x7B49;&#x6837;&#x5F0F;&#xFF0C;&#x800C;&#x8FD9;&#x79CD;&#x5730;&#x65B9;&#x5982;&#x679C;&#x8981;&#x8BA9;&#x7F8E;&#x5DE5;&#x518D;&#x53BB;&#x505A;&#x5F20;&#x56FE;&#x7247;&#x7684;&#x8BDD;&#x672A;&#x514D;&#x6709;&#x70B9;&#x5C0F;&#x9898;&#x5927;&#x505A;&#x7684;&#x611F;&#x89C9;&#xFF0C;&#x800C;&#x4E14;&#x6709;&#x65F6;&#x5019;&#x8FD8;&#x8981;&#x8003;&#x8651;&#x5404;&#x79CD;&#x9002;&#x914D;&#x95EE;&#x9898;&#xFF0C;&#x6240;&#x4EE5;&#x8FD9;&#x4E2A;&#x65F6;&#x5019;&#x4F7F;&#x7528;&#x6211;&#x4EEC;&#x7684; <code>shape</code>
&#x7684;&#x8BDD;&#x4FBF;&#x518D;&#x597D;&#x4E0D;&#x8FC7;&#x4E86;&#xFF0C;&#x4E0B;&#x9762;&#x4FBF;&#x4ECB;&#x7ECD;&#x4E00;&#x4E0B;&#x5173;&#x4E8E; <code>shape</code> &#x7684;&#x4F7F;&#x7528;&#x8FC7;&#x7A0B;&#x4E2D;&#x51FA;&#x73B0;&#x7684;&#x4E00;&#x4E9B;&#x5C5E;&#x6027;&#x3002;</p>
<p><strong>android:shape</strong> &#x6B64;&#x5C5E;&#x6027;&#x6709;&#x4EE5;&#x4E0B;4&#x79CD;&#x7C7B;&#x578B;&#x53EF;&#x4F9B;&#x9009;&#x62E9;</p>
<ul>
<li><strong>rectangle</strong>&#xFF1A;&#x77E9;&#x5F62;( &#x9ED8;&#x8BA4;)&#xFF0C;&#x53EF;&#x4EE5;&#x753B;&#x51FA;&#x76F4;&#x89D2;&#x77E9;&#x5F62;&#x3001;&#x5706;&#x89D2;&#x77E9;&#x5F62;&#x3001;&#x5F27;&#x5F62;&#x7B49;</li>
<li><strong>oval</strong>&#xFF1A;&#x692D;&#x5706;&#x5F62;&#xFF0C;&#x7528;&#x5F97;&#x6BD4;&#x8F83;&#x591A;&#x7684;&#x662F;&#x753B;&#x6B63;&#x5706;</li>
<li><strong>line</strong>&#xFF1A;&#x7EBF;&#x5F62;&#xFF0C;&#x53EF;&#x4EE5;&#x753B;&#x5B9E;&#x7EBF;&#x6216;&#x865A;&#x7EBF;</li>
<li><strong>ring</strong>&#xFF1A;&#x73AF;&#x5F62;&#xFF0C;&#x53EF;&#x4EE5;&#x753B;&#x73AF;&#x5F62;&#x8FB9;&#x6846;&#x6216;&#x73AF;&#x5F62;&#x8FDB;&#x5EA6;&#x6761;</li>
</ul>
<p>&#xFF08;&#x6CE8;&#xFF1A;&#x53EA;&#x6709;&#x5F53; <code>android:shape</code> &#x7684;&#x503C;&#x8BBE;&#x7F6E;&#x4E3A; <code>ring</code> &#x65F6;&#x4EE5;&#x4E0B;4&#x79CD;&#x5C5E;&#x6027;&#x624D;&#x4F1A;&#x751F;&#x6548;&#xFF09;</p>
<p><strong>android:innerRadius</strong>&#xFF1A;&#x5185;&#x73AF;&#x534A;&#x5F84;</p>
<p><strong>android:innerRadiusRatio</strong>&#xFF1A;&#x5185;&#x73AF;&#x534A;&#x5F84;&#x76F8;&#x5BF9;&#x4E8E;&#x73AF;&#x7684;&#x5BBD;&#x5EA6;&#x7684;&#x6BD4;&#x4F8B;&#xFF0C;&#x6BD4;&#x5982;&#x73AF;&#x7684;&#x5BBD;&#x5EA6;&#x4E3A;50,&#x6BD4;&#x4F8B;&#x4E3A;2.5,&#x90A3;&#x4E48;&#x5185;&#x73AF;&#x534A;&#x5F84;&#x4E3A;20</p>
<p><strong>android:thickness</strong>&#xFF1A;&#x73AF;&#x7684;&#x539A;&#x5EA6;</p>
<p><strong>android:thicknessRatio</strong>&#xFF1A;&#x73AF;&#x7684;&#x539A;&#x5EA6;&#x76F8;&#x5BF9;&#x4E8E;&#x73AF;&#x7684;&#x5BBD;&#x5EA6;&#x7684;&#x6BD4;&#x4F8B;</p>
<p><strong>android:useLevel</strong> &#x5982;&#x679C;&#x5F53;&#x505A;&#x662F;LevelListDrawable&#x4F7F;&#x7528;&#x65F6;&#x503C;&#x4E3A;true&#xFF0C;&#x5426;&#x5219;&#x4E3A;false.</p>
<p>&#x4E0A;&#x9762;&#x8FD9;&#x4E9B;&#x4FBF;&#x662F; <code>shape</code> &#x6807;&#x7B7E;&#x7684;&#x4E00;&#x4E9B;&#x5C5E;&#x6027;&#x4E86;,&#x63A5;&#x4E0B;&#x6765;&#x7684;&#x8BDD;&#x4FBF;&#x662F;&#x6211;&#x4EEC;&#x7684;&#x91CD;&#x70B9;&#x90E8;&#x5206;&#x4E86;,&#x90A3;&#x5C31;&#x662F;&#x4F7F;&#x7528; <code>shape</code>
&#x505A;&#x4E00;&#x4E9B;&#x5F62;&#x72B6;&#x7684;&#x7ED8;&#x5236;,&#x4E0B;&#x9762;&#x4FBF;&#x7B80;&#x5355;&#x4ECB;&#x7ECD;&#x4E0B;&#x4F7F;&#x7528;<code>shape</code> &#x7ED8;&#x5236;&#x5F62;&#x72B6;&#x65F6;&#x7684;&#x4E00;&#x4E9B;&#x6807;&#x7B7E;&#x53CA;&#x5176;&#x5C5E;&#x6027;</p>
<p><strong>corners</strong> &#x5B9A;&#x4E49;&#x5706;&#x89D2;,&#x5176;&#x5C5E;&#x6027;&#x5982;&#x4E0B;</p>
<ul>
<li><strong>android:radius</strong>&#xFF1A;&#x5168;&#x90E8;&#x7684;&#x5706;&#x89D2;&#x534A;&#x5F84;</li>
<li><strong>android:topLeftRadius</strong>&#xFF1A;&#x5DE6;&#x4E0A;&#x89D2;&#x7684;&#x5706;&#x89D2;&#x534A;&#x5F84;</li>
<li><strong>android:topRightRadius</strong>&#xFF1A;&#x53F3;&#x4E0A;&#x89D2;&#x7684;&#x5706;&#x89D2;&#x534A;&#x5F84;</li>
<li><strong>android:bottomLeftRadius</strong>&#xFF1A;&#x5DE6;&#x4E0B;&#x89D2;&#x7684;&#x5706;&#x89D2;&#x534A;&#x5F84;</li>
<li><strong>android:bottomRightRadius</strong>&#xFF1A;&#x53F3;&#x4E0B;&#x89D2;&#x7684;&#x5706;&#x89D2;&#x534A;&#x5F84;</li>
</ul>
<p>&#x5728;&#x5B9A;&#x4E49;&#x5706;&#x89D2;&#x7684;&#x65F6;&#x5019;&#x5927;&#x5BB6;&#x5E94;&#x8BE5;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4E24;&#x79CD;&#x5F62;&#x5F0F;&#x6765;&#x8FDB;&#x884C;&#x8BBE;&#x7F6E;,&#x5373;:</p>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;

    &lt;corners android:radius=&quot;15dp&quot;/&gt;
    &lt;solid android:color=&quot;#F00&quot;/&gt;

&lt;/shape&gt;
</code></pre><p>&#x4E0E;</p>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;

    &lt;corners android:bottomLeftRadius=&quot;15dp&quot;
    android:bottomRightRadius=&quot;15dp&quot;
    android:topLeftRadius=&quot;15dp&quot;
    android:topRightRadius=&quot;15dp&quot;/&gt;
    &lt;solid android:color=&quot;#F00&quot;/&gt;

&lt;/shape&gt;
</code></pre><p>&#x4E0A;&#x9762;&#x4E24;&#x79CD;&#x7684;&#x6548;&#x679C;&#x76F8;&#x540C;</p>
<p><strong>gradient</strong> &#x5B9A;&#x4E49;&#x6E10;&#x53D8;,&#x5176;&#x5C5E;&#x6027;&#x5982;&#x4E0B;</p>
<ul>
<li><strong>android:type</strong>&#xFF1A;&#x5171;&#x6709;3&#x4E2D;&#x6E10;&#x53D8;&#x7C7B;&#x578B;&#xFF0C;&#x7EBF;&#x6027;&#x6E10;&#x53D8;(linear)&#xFF08;&#x9ED8;&#x8BA4;&#xFF09;/&#x653E;&#x5C04;&#x6E10;&#x53D8;(radial)/&#x626B;&#x63CF;&#x5F0F;&#x6E10;&#x53D8;(sweep)</li>
<li><strong>android:angle</strong>&#xFF1A;&#x6E10;&#x53D8;&#x89D2;&#x5EA6;&#xFF0C;&#x5FC5;&#x987B;&#x4E3A;45&#x7684;&#x500D;&#x6570;&#xFF0C;0&#x4E3A;&#x4ECE;&#x5DE6;&#x5230;&#x53F3;&#xFF0C;90&#x4E3A;&#x4ECE;&#x4E0A;&#x5230;&#x4E0B;</li>
<li><strong>android:centerX</strong>&#xFF1A;&#x6E10;&#x53D8;&#x4E2D;&#x5FC3;X&#x7684;&#x76F8;&#x5F53;&#x4F4D;&#x7F6E;&#xFF0C;&#x8303;&#x56F4;&#x4E3A;0&#xFF5E;1</li>
<li><strong>android:centerY</strong>&#xFF1A;&#x6E10;&#x53D8;&#x4E2D;&#x5FC3;Y&#x7684;&#x76F8;&#x5F53;&#x4F4D;&#x7F6E;&#xFF0C;&#x8303;&#x56F4;&#x4E3A;0&#xFF5E;1</li>
<li><strong>android:startColor</strong>&#xFF1A;&#x6E10;&#x53D8;&#x5F00;&#x59CB;&#x70B9;&#x7684;&#x989C;&#x8272;</li>
<li><strong>android:centerColor</strong>&#xFF1A;&#x6E10;&#x53D8;&#x4E2D;&#x95F4;&#x70B9;&#x7684;&#x989C;&#x8272;&#xFF0C;&#x5728;&#x5F00;&#x59CB;&#x4E0E;&#x7ED3;&#x675F;&#x70B9;&#x4E4B;&#x95F4;</li>
<li><strong>android:endColor</strong>&#xFF1A;&#x6E10;&#x53D8;&#x7ED3;&#x675F;&#x70B9;&#x7684;&#x989C;&#x8272;</li>
<li><strong>android:gradientRadius</strong>&#xFF1A;&#x6E10;&#x53D8;&#x7684;&#x534A;&#x5F84;&#xFF0C;&#x53EA;&#x6709;&#x5F53;&#x6E10;&#x53D8;&#x7C7B;&#x578B;&#x4E3A;radial&#x65F6;&#x624D;&#x80FD;&#x4F7F;&#x7528;</li>
<li><strong>android:useLevel</strong>&#xFF1A;&#x4F7F;&#x7528;LevelListDrawable&#x65F6;&#x5C31;&#x8981;&#x8BBE;&#x7F6E;&#x4E3A;true&#x3002;&#x8BBE;&#x4E3A;false&#x65F6;&#x624D;&#x6709;&#x6E10;&#x53D8;&#x6548;&#x679C;</li>
</ul>
<p>&#x4EE3;&#x7801;&#x5982;&#x4E0B;</p>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;

    &lt;corners android:radius=&quot;15dp&quot;/&gt;

    &lt;gradient
    android:type=&quot;sweep&quot;
    android:angle=&quot;90&quot;
    android:centerX=&quot;0.2&quot;
    android:centerY=&quot;0.2&quot;
    android:centerColor=&quot;@color/colorAccent&quot;
    android:startColor=&quot;@color/colorPrimary&quot;
    android:endColor=&quot;@color/colorPrimaryDark&quot;/&gt;

    &lt;stroke android:width=&quot;1dp&quot;
    android:color=&quot;@android:color/white&quot;/&gt;

&lt;/shape&gt;
</code></pre><p><strong>solid</strong> &#x5B9A;&#x4E49;&#x586B;&#x5145;&#x8272;</p>
<ul>
<li><strong>android:color</strong>&#xFF1A;&#x5F62;&#x72B6;&#x5185;&#x90E8;&#x7684;&#x586B;&#x5145;&#x8272;</li>
</ul>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;

    &lt;solid android:color=&quot;#F00&quot;/&gt;

&lt;/shape&gt;
</code></pre><p><strong>stroke</strong> &#x5B9A;&#x4E49;&#x63CF;&#x8FB9;</p>
<ul>
<li><strong>android:width</strong>&#xFF1A;&#x63CF;&#x8FB9;&#x7684;&#x5BBD;&#x5EA6;</li>
<li><strong>android:color</strong>&#xFF1A;&#x63CF;&#x8FB9;&#x7684;&#x989C;&#x8272;</li>
<li><strong>android:dashWidth</strong>&#xFF1A;&#x865A;&#x7EBF;&#x7684;&#x5BBD;&#x5EA6;&#xFF0C;&#x503C;&#x4E3A;0&#x65F6;&#x662F;&#x5B9E;&#x7EBF;</li>
<li><strong>android:dashGap</strong>&#xFF1A;&#x865A;&#x7EBF;&#x7684;&#x95F4;&#x9694;</li>
</ul>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
android:shape=&quot;line&quot;&gt;
&lt;!--&#x5B9E;&#x7EBF;--&gt;
&lt;stroke android:width=&quot;2dp&quot;
android:color=&quot;@android:color/holo_purple&quot; /&gt;

&lt;/shape&gt;
</code></pre><pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
android:shape=&quot;line&quot;&gt;
&lt;!--&#x865A;&#x7EBF;--&gt;
&lt;stroke android:width=&quot;2dp&quot;
android:color=&quot;@android:color/holo_purple&quot;
android:dashWidth=&quot;10dp&quot;
android:dashGap=&quot;5dp&quot; /&gt;

&lt;/shape&gt;
</code></pre><p><strong>padding</strong> &#x5B9A;&#x4E49;&#x5F62;&#x72B6;&#x5185;&#x8FB9;&#x8DDD;</p>
<ul>
<li><strong>android:left</strong>&#xFF1A;&#x5DE6;&#x8FB9;&#x5185;&#x8FB9;&#x8DDD;</li>
<li><strong>android:top</strong>&#xFF1A;&#x4E0A;&#x65B9;&#x5185;&#x8FB9;&#x8DDD;</li>
<li><strong>android:right</strong>&#xFF1A;&#x53F3;&#x65B9;&#x5185;&#x8FB9;&#x8DDD;</li>
<li><strong>android:bottom</strong>&#xFF1A;&#x4E0B;&#x90E8;&#x5185;&#x8FB9;&#x8DDD;</li>
</ul>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
android:shape=&quot;line&quot;&gt;

&lt;padding
android:left=&quot;2dp&quot;
android:top=&quot;1dp&quot;
android:right=&quot;2dp&quot;
android:bottom=&quot;1dp&quot; /&gt;

&lt;/shape&gt;
</code></pre><p><strong>size</strong> &#x5B9A;&#x4E49;&#x5F62;&#x72B6;&#x7684;&#x5927;&#x5C0F;</p>
<ul>
<li><strong>android:width</strong>&#xFF1A;&#x5BBD;&#x5EA6;</li>
<li><strong>android:height</strong>&#xFF1A;&#x9AD8;&#x5EA6;</li>
</ul>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
android:shape=&quot;oval&quot;
android:useLevel=&quot;false&quot; &gt;

&lt;solid
android:color=&quot;#F00&quot; /&gt;

&lt;size android:width=&quot;15dp&quot;
android:height=&quot;15dp&quot; /&gt;

&lt;/shape&gt;
</code></pre><p>&#x6700;&#x540E;&#x9644;&#x4E0A;&#x672C;&#x6587;&#x4EE3;&#x7801;,&#x656C;&#x8BF7;&#x5927;&#x795E;&#x6307;&#x5BFC;<a href="https://github.com/ChenZengQing/AndroidUIStyleTest" title="Android &#x7684;UI &#x7F8E;&#x5316;&#x65B9;&#x5F0F;" target="_blank">Android &#x7684;UI &#x7F8E;&#x5316;&#x65B9;&#x5F0F;</a></p>
<p>&#x66F4;&#x591A;&#x5185;&#x5BB9;&#x8BF7;&#x79FB;&#x9A7E; <a href="http://zengqing.top/" target="_blank">&#x6211;&#x7684;&#x535A;&#x5BA2;</a> </p>
<footer class="page-footer"><span class="copyright">Copyright &amp; copy zengqing.top 2023 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x66F4;&#x65B0;&#x4E8E;&#xFF1A;
2023-03-25 21:02:03
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="Android 多包名打包应用.html" class="navigation navigation-prev " aria-label="Previous page: Android 多包名打包应用">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../ReactNative/CodePush 热更新配置及使用.html" class="navigation navigation-next " aria-label="Next page: CodePush 热更新配置及使用">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Android UI美化之 shape的使用及其属性总结","level":"2.2","depth":1,"next":{"title":"CodePush 热更新配置及使用","level":"3.1","depth":1,"path":"ReactNative/CodePush 热更新配置及使用.md","ref":"./ReactNative/CodePush 热更新配置及使用.md","articles":[]},"previous":{"title":"Android 多包名打包应用","level":"2.1","depth":1,"path":"Android/Android 多包名打包应用.md","ref":"./Android/Android 多包名打包应用.md","articles":[]},"dir":"ltr"},"config":{"plugins":["expandable-chapters","code","pageview-count","chapter-fold","expandable-chapters-small","tbfed-pagefooter","hide-element","ancre-navigation"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright & copy zengqing.top 2023","modify_label":"该文件更新于：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"code":{"copyButtons":true},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"pageview-count":{},"ancre-navigation":{"showLevel":true,"associatedWithSummary":true,"mode":"float","printLog":false,"multipleH1":true,"float":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""}},"expandable-chapters-small":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"XiaoChen","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"《前端学习笔记》","language":"zh-hans","gitbook":"*","description":"个人学习笔记，记录学习过程中的点点滴滴"},"file":{"path":"Android/Android UI美化之 shape的使用及其属性总结.md","mtime":"2023-03-25T13:02:03.390Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2023-03-26T04:06:26.355Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

